<HTML><HEAD><TITLE>rename(+OldName, +NewName)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Operating System</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>rename(+OldName, +NewName)</H1>
Renames the file OldName to NewName.


<DL>
<DT><EM>OldName</EM></DT>
<DD>String or atom.
</DD>
<DT><EM>NewName</EM></DT>
<DD>String or atom.
</DD>
</DL>
<H2>Description</H2>
   OldName and NewName are absolute or relative pathnames of files.  Used
   to rename the file OldName with the name NewName.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>rename(+, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Either OldName or NewName are not instantiated.
<DT><EM>(5) type error </EM>
<DD>Either OldName or NewName are neither a string nor an atom.
<DT><EM>(190) end of file reached </EM>
<DD>File OldName does not exist.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: sh('ls file1').
      file1
      [eclipse]: rename(file1, file2).
      yes.
      [eclipse]: sh('ls file1 file2').
      file1 not found
      file2
      yes.

Error:
      rename(Old, any).             (Error 4).
      rename(any, New).             (Error 4).
      rename(1, any).               (Error 5).
      rename(notfile, newfile).     (Error 190).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/opsys/exists-1.html">exists / 1</A>, <A HREF="../../kernel/opsys/delete-1.html">delete / 1</A>, <A HREF="../../kernel/opsys/mkdir-1.html">mkdir / 1</A>
</BODY></HTML>
